package lab02.test04;

public class Staff {
    //定义员工姓名、编号、基础工资、上涨工资
    String name;
    long num;
    double baseSalary;
    double upSalary;
    int workTime;

    //无参构造
    public Staff() {
    }

    //有参构造
    public Staff(float baseSalary, int workTime) {

        this.baseSalary = baseSalary;

        this.workTime = workTime;
    }

    //获取姓名
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    //获取员工号
    public void setNum(long num) {
        this.num = num;
    }

    public long getNum() {
        return num;
    }

    //获取基础工资
    public void setBaseSalary(float baseSalary) {
        this.baseSalary = baseSalary;
    }

    public double getBaseSalary() {
        return baseSalary;
    }

    public void setUpSalary(float upSalary) {
        this.upSalary = upSalary;
    }

    public double getUpSalary() {
        return upSalary;
    }

    //求增长额
    double upSalary() {
        if (workTime > 240) {
            upSalary = (workTime - 240) * 10;
        }
        return upSalary;
    }

    //总工资
    double salary() {
        double salary;
        salary = upSalary + baseSalary;
        return salary;
    }

    @Override
    public String toString() {
        return name + "\t" + num;
    }

}
